<template>
  <!-- 排队管理明细页面弹出框-->
  <el-dialog
    title="行内排队管理"
    center
    :visible.sync="open"
    width="1024px"
    :close-on-click-modal="false"
    @close="closeFn"
    :before-close="handleClose"
  >
    <el-form ref="detailsForm" :model="formData" label-width="170px" :disabled="true">
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="队列流水号：" prop="id">
            <el-input v-model="formData.id" placeholder="队列流水号" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="交易流水号：" prop="coreId">
            <el-input v-model="formData.coreId" placeholder="交易流水号" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="付款人账号：" prop="payerActno">
            <el-input v-model="formData.payerActno" placeholder="付款人账号" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="付款人名称：" prop="payerName">
            <el-input v-model="formData.payerName" placeholder="付款人名称" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="付款行行号：" prop="payerBrno">
            <el-input v-model="formData.payerBrno" placeholder="付款行行号" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="付款行行名：" prop="payerBrname">
            <el-input v-model="formData.payerBrname" placeholder="付款行行名" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="收款人账号：" prop="payeeActno">
            <el-input v-model="formData.payeeActno" placeholder="收款人账号" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="收款人名称：" prop="payeeName">
            <el-input v-model="formData.payeeName" placeholder="收款人名称" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="收款行行号：" prop="payeeBrno">
            <el-input v-model="formData.payeeBrno" placeholder="收款行行号" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="收款行行名：" prop="payeeBrname">
            <el-input v-model="formData.payeeBrname" placeholder="收款行行名" />
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="金额：" prop="amount">
            <el-input v-model="formData.amount" placeholder="金额" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="入队时间：" prop="inTime">
            <el-date-picker
              v-model="formData.inTime"
              type="date"
              value-format="yyyyMMdd"
              placeholder="选择时间"
              style="width: 100%"
            ></el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="录入操作员：" prop="mdTlrno">
            <el-input v-model="formData.mdTlrno" placeholder="录入操作员" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="录入时间：" prop="mdTime">
            <el-date-picker
              v-model="formData.mdTime"
              type="date"
              value-format="yyyyMMdd"
              placeholder="选择时间"
              style="width: 100%"
            ></el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row type="flex">
        <el-col :span="12">
          <el-form-item label="审核操作员：" prop="audTlrno">
            <el-input v-model="formData.audTlrno" placeholder="审核操作员" />
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="审核时间：" prop="audTime">
            <el-date-picker
              v-model="formData.audTime"
              type="date"
              value-format="yyyyMMdd"
              placeholder="选择时间"
              style="width: 100%"
            ></el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div slot="footer" class="dialog-footer">
      <el-button type="primary" v-if="isHead" @click="saveFn('01')" :loading="isLoading">移至队首</el-button>
      <el-button type="primary" v-if="isEnd" @click="saveFn('02')" :loading="isLoading">移至队尾</el-button>
      <el-button type="warning" @click="saveFn('03')" :loading="isLoading">立即发送</el-button>
      <el-button @click="handleClose">关闭</el-button>
    </div>
  </el-dialog>
</template>
<script>
import { save } from "@/api/cnaps/bizMng/internalQueue.js";
import { log } from "util";
export default {
  name: "ControlDetails",
  components: {},
  props: {
    dictMap: {
      type: Object,
      default: () => {
        return {};
      },
    },
    formData: {
      type: Object,
      default: () => {
        return {};
      },
    },
  },
  data() {
    return {
      // 是否显示弹出层
      open: false,
      isLoading: false,
      isHead: false,
      isEnd: false,
    };
  },
  watch: {
    open(val) {
      if (val) {
        if (this.formData.pid) {
          this.isHead = true;
        } else {
          this.isHead = false;
        }
        if (this.formData.placeFlag == "02") {
          this.isEnd = false;
        } else {
          this.isEnd = true;
        }
      }
    },
  },
  mounted() {},
  methods: {
    saveFn(type) {
      this.isLoading = true;
      let saveData = {
        qid: this.formData.id,
        coreId: this.formData.coreId,
        sysTypeQueue: type,
      };
      save(saveData)
        .then((res) => {
          console.log(res, "操作成功");
          this.isLoading = false;
          this.$emit("editComplete", true);
          this.msgSuccess("操作成功!");
          this.closeFn();
        })
        .catch((err) => {
          this.isLoading = false;
        });
    },
    // 表单重置
    reset() {
      this.resetForm("detailsForm");
      // this.$set(this, "form", {});
    },

    // 关闭回掉
    handleClose(done) {
      this.$confirm("确认关闭？")
        .then((_) => {
          this.open = false;
          this.reset();
          done();
        })
        .catch((_) => {});
    },

    closeFn() {
      this.open = false;
      this.reset();
    },
    show() {
      this.open = true;
    },
  },
};
</script>
<style lang="scss" scoped>
.label-header-msg {
  font-weight: bold;
}

.form-card {
  margin-bottom: 10px;
}
</style>
